﻿using System.Windows;
using System.Windows.Controls;

namespace Company.Shell.Controls
{
    /// <summary>
    /// ADU.xaml 的交互逻辑
    /// </summary>
    public partial class ADU : UserControl
    {
        public ADU()
        {
            InitializeComponent();
        }

        /// <summary>
        /// 温度值
        /// </summary>
        public string Text
        {
            get { return (string)GetValue(TextProperty); }
            set { SetValue(TextProperty, value); }
        }

        public static readonly DependencyProperty TextProperty =
            DependencyProperty.Register("Text", typeof(string), typeof(ADU), new PropertyMetadata("ADU", new PropertyChangedCallback(TextChangedCallback)));

        private static void TextChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var control = (ADU)d;
            if (control == null)
                return;
            if (e.NewValue != null)
            {
                control._textblock.Text = (string)e.NewValue;
            }
        }
    }
}
